﻿using System;
using System.Windows.Automation;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace QuickUIT.Tests
{
    [TestClass]
    public class AutomationElementContainsSearchConditionTests
    {
        [TestMethod]
        [ExpectedException(typeof(ArgumentNullException))]
        public void ShouldThrowExceptionOnNullProperty()
        {
            var containsSearchCondition = new AutomationElementContainsSearchCondition(null, "Test"); 
        }

        [TestMethod]
        public void ShouldGetToStringProperty()
        {
            var containsSearchCondition = new AutomationElementContainsSearchCondition(AutomationElement.NameProperty, "Test");
            Assert.AreEqual("Name=Contains('Test')", containsSearchCondition.ToString());
        }

        [TestMethod]
        public void ShouldGetToStringPropertyWithEmptyValue()
        {
            var containsSearchCondition = new AutomationElementContainsSearchCondition(AutomationElement.NameProperty, String.Empty);
            Assert.AreEqual("Name=Contains('')", containsSearchCondition.ToString());
        }
    }
}
